#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m;
int q[N];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &q[i]);
	}
	while (m--) {
		int a;
		scanf("%d", &a);
		int l = 0, r = n - 1;
		while (l < r) {
			int mid = l + r >> 1;
			if (q[mid] >= a) {
				r = mid;
			} else {
				l =  mid + 1;
			}
		}
		if (q[l] == a) {
			printf("%d ", l + 1);
		} else {
			printf("%d ", -1);
		}

	}
	return 0;
}